var $addressBtn;
var $aboutBtn;
var $meOrderBtn;
var $nickname;
var $point;

var $payBtn;
var $deliveryBtn;
var $receiptBtn;
var $evaluationBtn;

var user;

function init() {
    $addressBtn = $('#addressBtn');
    $aboutBtn = $('#aboutBtn');
    $meOrderBtn = $('#meOrderBtn');
    $nickname = $('#nickname');
    $point = $('#point');

    $payBtn = $('#payBtn');
    $deliveryBtn = $('#deliveryBtn');
    $receiptBtn = $('#receiptBtn');
    $evaluationBtn = $('#evaluationBtn');

    user = JSON.parse($.cookie('user'));

}

function initView() {

    if (user) {
        $nickname.text(user.nickname);
        $point.text(user.point);
    }


}

function initListener() {
    $meOrderBtn.bind('tap', function () {
        mui.openWindow('../orderlist/index.html?index=0', 'id');
    });
    $addressBtn.bind('tap', function () {
        mui.openWindow('../address/index.html', 'id');
    });
    $aboutBtn.bind('tap', function () {
        mui.openWindow('../about/index.html', 'id');
    });

    $payBtn.bind('tap', function () {
        mui.openWindow('../orderlist/index.html?index=1', 'id');
    });

    $deliveryBtn.bind('tap', function () {
        mui.openWindow('../orderlist/index.html?index=2', 'id');
    });

    $receiptBtn.bind('tap', function () {
        mui.openWindow('../orderlist/index.html?index=3', 'id');
    });

    $evaluationBtn.bind('tap', function () {
        mui.openWindow('../orderlist/index.html?index=4', 'id');
    });

}


$(function () {
    init();
    initView();
    initListener();
});
